// 工具函数实现
use anyhow::Result;

pub fn validate_username(username: &str) -> Result<()> {
    if username.is_empty() || username.len() > 50 {
        return Err(anyhow::anyhow!("Invalid username"));
    }
    Ok(())
}

pub fn validate_password(password: &str) -> Result<()> {
    if password.len() < 6 {
        return Err(anyhow::anyhow!("Password too short"));
    }
    Ok(())
}
